package tools.jackson.module.kotlin.kogeraIntegration.deser.valueClass.parameterSize.primitive

import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test
import tools.jackson.module.kotlin.assertReflectEquals
import tools.jackson.module.kotlin.defaultMapper
import tools.jackson.module.kotlin.kogeraIntegration.deser.valueClass.Primitive
import tools.jackson.module.kotlin.readValue

/**
 * Up to argument size 32 there is one mask argument for the default argument,
 * 33 ~ 64 there are two, and 65 there are three, so each boundary value is tested.
 * Also, if the default argument is set, the maximum argument size that can be set in the constructor is 245,
 * so that case is tested as well.
 */
class DeserializeByConstructorWithDefaultArgumentsTest {
    data class Dst32(
        val p00: Primitive = Primitive(0),
        val p01: Primitive = Primitive(1),
        val p02: Primitive = Primitive(2),
        val p03: Primitive = Primitive(3),
        val p04: Primitive = Primitive(4),
        val p05: Primitive = Primitive(5),
        val p06: Primitive = Primitive(6),
        val p07: Primitive = Primitive(7),
        val p08: Primitive = Primitive(8),
        val p09: Primitive = Primitive(9),
        val p10: Primitive = Primitive(10),
        val p11: Primitive = Primitive(11),
        val p12: Primitive = Primitive(12),
        val p13: Primitive = Primitive(13),
        val p14: Primitive = Primitive(14),
        val p15: Primitive = Primitive(15),
        val p16: Primitive = Primitive(16),
        val p17: Primitive = Primitive(17),
        val p18: Primitive = Primitive(18),
        val p19: Primitive = Primitive(19),
        val p20: Primitive = Primitive(20),
        val p21: Primitive = Primitive(21),
        val p22: Primitive = Primitive(22),
        val p23: Primitive = Primitive(23),
        val p24: Primitive = Primitive(24),
        val p25: Primitive = Primitive(25),
        val p26: Primitive = Primitive(26),
        val p27: Primitive = Primitive(27),
        val p28: Primitive = Primitive(28),
        val p29: Primitive = Primitive(29),
        val p30: Primitive = Primitive(30),
        val p31: Primitive = Primitive(31)
    )

    @Test
    fun test32() {
        assertEquals(Dst32(), defaultMapper.readValue<Dst32>("{}"))
    }

    data class Dst33(
        val p00: Primitive = Primitive(0),
        val p01: Primitive = Primitive(1),
        val p02: Primitive = Primitive(2),
        val p03: Primitive = Primitive(3),
        val p04: Primitive = Primitive(4),
        val p05: Primitive = Primitive(5),
        val p06: Primitive = Primitive(6),
        val p07: Primitive = Primitive(7),
        val p08: Primitive = Primitive(8),
        val p09: Primitive = Primitive(9),
        val p10: Primitive = Primitive(10),
        val p11: Primitive = Primitive(11),
        val p12: Primitive = Primitive(12),
        val p13: Primitive = Primitive(13),
        val p14: Primitive = Primitive(14),
        val p15: Primitive = Primitive(15),
        val p16: Primitive = Primitive(16),
        val p17: Primitive = Primitive(17),
        val p18: Primitive = Primitive(18),
        val p19: Primitive = Primitive(19),
        val p20: Primitive = Primitive(20),
        val p21: Primitive = Primitive(21),
        val p22: Primitive = Primitive(22),
        val p23: Primitive = Primitive(23),
        val p24: Primitive = Primitive(24),
        val p25: Primitive = Primitive(25),
        val p26: Primitive = Primitive(26),
        val p27: Primitive = Primitive(27),
        val p28: Primitive = Primitive(28),
        val p29: Primitive = Primitive(29),
        val p30: Primitive = Primitive(30),
        val p31: Primitive = Primitive(31),
        val p32: Primitive = Primitive(32)
    )

    @Test
    fun test33() {
        assertEquals(Dst33(), defaultMapper.readValue<Dst33>("{}"))
    }

    data class Dst64(
        val p00: Primitive = Primitive(0),
        val p01: Primitive = Primitive(1),
        val p02: Primitive = Primitive(2),
        val p03: Primitive = Primitive(3),
        val p04: Primitive = Primitive(4),
        val p05: Primitive = Primitive(5),
        val p06: Primitive = Primitive(6),
        val p07: Primitive = Primitive(7),
        val p08: Primitive = Primitive(8),
        val p09: Primitive = Primitive(9),
        val p10: Primitive = Primitive(10),
        val p11: Primitive = Primitive(11),
        val p12: Primitive = Primitive(12),
        val p13: Primitive = Primitive(13),
        val p14: Primitive = Primitive(14),
        val p15: Primitive = Primitive(15),
        val p16: Primitive = Primitive(16),
        val p17: Primitive = Primitive(17),
        val p18: Primitive = Primitive(18),
        val p19: Primitive = Primitive(19),
        val p20: Primitive = Primitive(20),
        val p21: Primitive = Primitive(21),
        val p22: Primitive = Primitive(22),
        val p23: Primitive = Primitive(23),
        val p24: Primitive = Primitive(24),
        val p25: Primitive = Primitive(25),
        val p26: Primitive = Primitive(26),
        val p27: Primitive = Primitive(27),
        val p28: Primitive = Primitive(28),
        val p29: Primitive = Primitive(29),
        val p30: Primitive = Primitive(30),
        val p31: Primitive = Primitive(31),
        val p32: Primitive = Primitive(32),
        val p33: Primitive = Primitive(33),
        val p34: Primitive = Primitive(34),
        val p35: Primitive = Primitive(35),
        val p36: Primitive = Primitive(36),
        val p37: Primitive = Primitive(37),
        val p38: Primitive = Primitive(38),
        val p39: Primitive = Primitive(39),
        val p40: Primitive = Primitive(40),
        val p41: Primitive = Primitive(41),
        val p42: Primitive = Primitive(42),
        val p43: Primitive = Primitive(43),
        val p44: Primitive = Primitive(44),
        val p45: Primitive = Primitive(45),
        val p46: Primitive = Primitive(46),
        val p47: Primitive = Primitive(47),
        val p48: Primitive = Primitive(48),
        val p49: Primitive = Primitive(49),
        val p50: Primitive = Primitive(50),
        val p51: Primitive = Primitive(51),
        val p52: Primitive = Primitive(52),
        val p53: Primitive = Primitive(53),
        val p54: Primitive = Primitive(54),
        val p55: Primitive = Primitive(55),
        val p56: Primitive = Primitive(56),
        val p57: Primitive = Primitive(57),
        val p58: Primitive = Primitive(58),
        val p59: Primitive = Primitive(59),
        val p60: Primitive = Primitive(60),
        val p61: Primitive = Primitive(61),
        val p62: Primitive = Primitive(62),
        val p63: Primitive = Primitive(63)
    )

    @Test
    fun test64() {
        assertEquals(Dst64(), defaultMapper.readValue<Dst64>("{}"))
    }

    data class Dst65(
        val p00: Primitive = Primitive(0),
        val p01: Primitive = Primitive(1),
        val p02: Primitive = Primitive(2),
        val p03: Primitive = Primitive(3),
        val p04: Primitive = Primitive(4),
        val p05: Primitive = Primitive(5),
        val p06: Primitive = Primitive(6),
        val p07: Primitive = Primitive(7),
        val p08: Primitive = Primitive(8),
        val p09: Primitive = Primitive(9),
        val p10: Primitive = Primitive(10),
        val p11: Primitive = Primitive(11),
        val p12: Primitive = Primitive(12),
        val p13: Primitive = Primitive(13),
        val p14: Primitive = Primitive(14),
        val p15: Primitive = Primitive(15),
        val p16: Primitive = Primitive(16),
        val p17: Primitive = Primitive(17),
        val p18: Primitive = Primitive(18),
        val p19: Primitive = Primitive(19),
        val p20: Primitive = Primitive(20),
        val p21: Primitive = Primitive(21),
        val p22: Primitive = Primitive(22),
        val p23: Primitive = Primitive(23),
        val p24: Primitive = Primitive(24),
        val p25: Primitive = Primitive(25),
        val p26: Primitive = Primitive(26),
        val p27: Primitive = Primitive(27),
        val p28: Primitive = Primitive(28),
        val p29: Primitive = Primitive(29),
        val p30: Primitive = Primitive(30),
        val p31: Primitive = Primitive(31),
        val p32: Primitive = Primitive(32),
        val p33: Primitive = Primitive(33),
        val p34: Primitive = Primitive(34),
        val p35: Primitive = Primitive(35),
        val p36: Primitive = Primitive(36),
        val p37: Primitive = Primitive(37),
        val p38: Primitive = Primitive(38),
        val p39: Primitive = Primitive(39),
        val p40: Primitive = Primitive(40),
        val p41: Primitive = Primitive(41),
        val p42: Primitive = Primitive(42),
        val p43: Primitive = Primitive(43),
        val p44: Primitive = Primitive(44),
        val p45: Primitive = Primitive(45),
        val p46: Primitive = Primitive(46),
        val p47: Primitive = Primitive(47),
        val p48: Primitive = Primitive(48),
        val p49: Primitive = Primitive(49),
        val p50: Primitive = Primitive(50),
        val p51: Primitive = Primitive(51),
        val p52: Primitive = Primitive(52),
        val p53: Primitive = Primitive(53),
        val p54: Primitive = Primitive(54),
        val p55: Primitive = Primitive(55),
        val p56: Primitive = Primitive(56),
        val p57: Primitive = Primitive(57),
        val p58: Primitive = Primitive(58),
        val p59: Primitive = Primitive(59),
        val p60: Primitive = Primitive(60),
        val p61: Primitive = Primitive(61),
        val p62: Primitive = Primitive(62),
        val p63: Primitive = Primitive(63),
        val p64: Primitive = Primitive(64)
    )

    @Test
    fun test65() {
        assertEquals(Dst65(), defaultMapper.readValue<Dst65>("{}"))
    }

    // It cannot be a data class because the generated method would exceed the argument size limit.
    class DstMax(
        val p000: Primitive = Primitive(0),
        val p001: Primitive = Primitive(1),
        val p002: Primitive = Primitive(2),
        val p003: Primitive = Primitive(3),
        val p004: Primitive = Primitive(4),
        val p005: Primitive = Primitive(5),
        val p006: Primitive = Primitive(6),
        val p007: Primitive = Primitive(7),
        val p008: Primitive = Primitive(8),
        val p009: Primitive = Primitive(9),
        val p010: Primitive = Primitive(10),
        val p011: Primitive = Primitive(11),
        val p012: Primitive = Primitive(12),
        val p013: Primitive = Primitive(13),
        val p014: Primitive = Primitive(14),
        val p015: Primitive = Primitive(15),
        val p016: Primitive = Primitive(16),
        val p017: Primitive = Primitive(17),
        val p018: Primitive = Primitive(18),
        val p019: Primitive = Primitive(19),
        val p020: Primitive = Primitive(20),
        val p021: Primitive = Primitive(21),
        val p022: Primitive = Primitive(22),
        val p023: Primitive = Primitive(23),
        val p024: Primitive = Primitive(24),
        val p025: Primitive = Primitive(25),
        val p026: Primitive = Primitive(26),
        val p027: Primitive = Primitive(27),
        val p028: Primitive = Primitive(28),
        val p029: Primitive = Primitive(29),
        val p030: Primitive = Primitive(30),
        val p031: Primitive = Primitive(31),
        val p032: Primitive = Primitive(32),
        val p033: Primitive = Primitive(33),
        val p034: Primitive = Primitive(34),
        val p035: Primitive = Primitive(35),
        val p036: Primitive = Primitive(36),
        val p037: Primitive = Primitive(37),
        val p038: Primitive = Primitive(38),
        val p039: Primitive = Primitive(39),
        val p040: Primitive = Primitive(40),
        val p041: Primitive = Primitive(41),
        val p042: Primitive = Primitive(42),
        val p043: Primitive = Primitive(43),
        val p044: Primitive = Primitive(44),
        val p045: Primitive = Primitive(45),
        val p046: Primitive = Primitive(46),
        val p047: Primitive = Primitive(47),
        val p048: Primitive = Primitive(48),
        val p049: Primitive = Primitive(49),
        val p050: Primitive = Primitive(50),
        val p051: Primitive = Primitive(51),
        val p052: Primitive = Primitive(52),
        val p053: Primitive = Primitive(53),
        val p054: Primitive = Primitive(54),
        val p055: Primitive = Primitive(55),
        val p056: Primitive = Primitive(56),
        val p057: Primitive = Primitive(57),
        val p058: Primitive = Primitive(58),
        val p059: Primitive = Primitive(59),
        val p060: Primitive = Primitive(60),
        val p061: Primitive = Primitive(61),
        val p062: Primitive = Primitive(62),
        val p063: Primitive = Primitive(63),
        val p064: Primitive = Primitive(64),
        val p065: Primitive = Primitive(65),
        val p066: Primitive = Primitive(66),
        val p067: Primitive = Primitive(67),
        val p068: Primitive = Primitive(68),
        val p069: Primitive = Primitive(69),
        val p070: Primitive = Primitive(70),
        val p071: Primitive = Primitive(71),
        val p072: Primitive = Primitive(72),
        val p073: Primitive = Primitive(73),
        val p074: Primitive = Primitive(74),
        val p075: Primitive = Primitive(75),
        val p076: Primitive = Primitive(76),
        val p077: Primitive = Primitive(77),
        val p078: Primitive = Primitive(78),
        val p079: Primitive = Primitive(79),
        val p080: Primitive = Primitive(80),
        val p081: Primitive = Primitive(81),
        val p082: Primitive = Primitive(82),
        val p083: Primitive = Primitive(83),
        val p084: Primitive = Primitive(84),
        val p085: Primitive = Primitive(85),
        val p086: Primitive = Primitive(86),
        val p087: Primitive = Primitive(87),
        val p088: Primitive = Primitive(88),
        val p089: Primitive = Primitive(89),
        val p090: Primitive = Primitive(90),
        val p091: Primitive = Primitive(91),
        val p092: Primitive = Primitive(92),
        val p093: Primitive = Primitive(93),
        val p094: Primitive = Primitive(94),
        val p095: Primitive = Primitive(95),
        val p096: Primitive = Primitive(96),
        val p097: Primitive = Primitive(97),
        val p098: Primitive = Primitive(98),
        val p099: Primitive = Primitive(99),
        val p100: Primitive = Primitive(100),
        val p101: Primitive = Primitive(101),
        val p102: Primitive = Primitive(102),
        val p103: Primitive = Primitive(103),
        val p104: Primitive = Primitive(104),
        val p105: Primitive = Primitive(105),
        val p106: Primitive = Primitive(106),
        val p107: Primitive = Primitive(107),
        val p108: Primitive = Primitive(108),
        val p109: Primitive = Primitive(109),
        val p110: Primitive = Primitive(110),
        val p111: Primitive = Primitive(111),
        val p112: Primitive = Primitive(112),
        val p113: Primitive = Primitive(113),
        val p114: Primitive = Primitive(114),
        val p115: Primitive = Primitive(115),
        val p116: Primitive = Primitive(116),
        val p117: Primitive = Primitive(117),
        val p118: Primitive = Primitive(118),
        val p119: Primitive = Primitive(119),
        val p120: Primitive = Primitive(120),
        val p121: Primitive = Primitive(121),
        val p122: Primitive = Primitive(122),
        val p123: Primitive = Primitive(123),
        val p124: Primitive = Primitive(124),
        val p125: Primitive = Primitive(125),
        val p126: Primitive = Primitive(126),
        val p127: Primitive = Primitive(127),
        val p128: Primitive = Primitive(128),
        val p129: Primitive = Primitive(129),
        val p130: Primitive = Primitive(130),
        val p131: Primitive = Primitive(131),
        val p132: Primitive = Primitive(132),
        val p133: Primitive = Primitive(133),
        val p134: Primitive = Primitive(134),
        val p135: Primitive = Primitive(135),
        val p136: Primitive = Primitive(136),
        val p137: Primitive = Primitive(137),
        val p138: Primitive = Primitive(138),
        val p139: Primitive = Primitive(139),
        val p140: Primitive = Primitive(140),
        val p141: Primitive = Primitive(141),
        val p142: Primitive = Primitive(142),
        val p143: Primitive = Primitive(143),
        val p144: Primitive = Primitive(144),
        val p145: Primitive = Primitive(145),
        val p146: Primitive = Primitive(146),
        val p147: Primitive = Primitive(147),
        val p148: Primitive = Primitive(148),
        val p149: Primitive = Primitive(149),
        val p150: Primitive = Primitive(150),
        val p151: Primitive = Primitive(151),
        val p152: Primitive = Primitive(152),
        val p153: Primitive = Primitive(153),
        val p154: Primitive = Primitive(154),
        val p155: Primitive = Primitive(155),
        val p156: Primitive = Primitive(156),
        val p157: Primitive = Primitive(157),
        val p158: Primitive = Primitive(158),
        val p159: Primitive = Primitive(159),
        val p160: Primitive = Primitive(160),
        val p161: Primitive = Primitive(161),
        val p162: Primitive = Primitive(162),
        val p163: Primitive = Primitive(163),
        val p164: Primitive = Primitive(164),
        val p165: Primitive = Primitive(165),
        val p166: Primitive = Primitive(166),
        val p167: Primitive = Primitive(167),
        val p168: Primitive = Primitive(168),
        val p169: Primitive = Primitive(169),
        val p170: Primitive = Primitive(170),
        val p171: Primitive = Primitive(171),
        val p172: Primitive = Primitive(172),
        val p173: Primitive = Primitive(173),
        val p174: Primitive = Primitive(174),
        val p175: Primitive = Primitive(175),
        val p176: Primitive = Primitive(176),
        val p177: Primitive = Primitive(177),
        val p178: Primitive = Primitive(178),
        val p179: Primitive = Primitive(179),
        val p180: Primitive = Primitive(180),
        val p181: Primitive = Primitive(181),
        val p182: Primitive = Primitive(182),
        val p183: Primitive = Primitive(183),
        val p184: Primitive = Primitive(184),
        val p185: Primitive = Primitive(185),
        val p186: Primitive = Primitive(186),
        val p187: Primitive = Primitive(187),
        val p188: Primitive = Primitive(188),
        val p189: Primitive = Primitive(189),
        val p190: Primitive = Primitive(190),
        val p191: Primitive = Primitive(191),
        val p192: Primitive = Primitive(192),
        val p193: Primitive = Primitive(193),
        val p194: Primitive = Primitive(194),
        val p195: Primitive = Primitive(195),
        val p196: Primitive = Primitive(196),
        val p197: Primitive = Primitive(197),
        val p198: Primitive = Primitive(198),
        val p199: Primitive = Primitive(199),
        val p200: Primitive = Primitive(200),
        val p201: Primitive = Primitive(201),
        val p202: Primitive = Primitive(202),
        val p203: Primitive = Primitive(203),
        val p204: Primitive = Primitive(204),
        val p205: Primitive = Primitive(205),
        val p206: Primitive = Primitive(206),
        val p207: Primitive = Primitive(207),
        val p208: Primitive = Primitive(208),
        val p209: Primitive = Primitive(209),
        val p210: Primitive = Primitive(210),
        val p211: Primitive = Primitive(211),
        val p212: Primitive = Primitive(212),
        val p213: Primitive = Primitive(213),
        val p214: Primitive = Primitive(214),
        val p215: Primitive = Primitive(215),
        val p216: Primitive = Primitive(216),
        val p217: Primitive = Primitive(217),
        val p218: Primitive = Primitive(218),
        val p219: Primitive = Primitive(219),
        val p220: Primitive = Primitive(220),
        val p221: Primitive = Primitive(221),
        val p222: Primitive = Primitive(222),
        val p223: Primitive = Primitive(223),
        val p224: Primitive = Primitive(224),
        val p225: Primitive = Primitive(225),
        val p226: Primitive = Primitive(226),
        val p227: Primitive = Primitive(227),
        val p228: Primitive = Primitive(228),
        val p229: Primitive = Primitive(229),
        val p230: Primitive = Primitive(230),
        val p231: Primitive = Primitive(231),
        val p232: Primitive = Primitive(232),
        val p233: Primitive = Primitive(233),
        val p234: Primitive = Primitive(234),
        val p235: Primitive = Primitive(235),
        val p236: Primitive = Primitive(236),
        val p237: Primitive = Primitive(237),
        val p238: Primitive = Primitive(238),
        val p239: Primitive = Primitive(239),
        val p240: Primitive = Primitive(240),
        val p241: Primitive = Primitive(241),
        val p242: Primitive = Primitive(242),
        val p243: Primitive = Primitive(243),
        val p244: Primitive = Primitive(244)
    )

    @Test
    fun testMax() {
        assertReflectEquals(DstMax(), defaultMapper.readValue<DstMax>("{}"))
    }
}
